home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4681 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.0 KB  |  58 lines

  1. Path: in1.uu.net!DIALix!gmhuucp!chris.cheek
  2. Newsgroups: comp.lang.c
  3. In-Reply-To: who.ever.asked@ucagmh.DIALix.oz.au
  4. Subject: Re: rebooting computer in C.
  5. From: chris.cheek@ucagmh.DIALix.oz.au
  6. Message-ID: <COLACE.9807@ucagmh.DIALix.oz.au>
  7. Date: Tue, 6 Feb 96 20:48:00 +0730
  8. Organization: The Flaming Dove, Karratha WA
  9.  
  10. >In article <4emjjj$713@donatello.leonardo.net>, DavidJo@zianet.com (DavidJo)
  11. >ites...
  12. >>How would I go about making the computer reboot from inside a C
  13. >>program?
  14. >
  15. >How you do this (or _if_ you can) depends on your operating system, so you
  16. >should ask this in a group dedicated to that operating system.  The C langua
  17. >itself has no support for this sort of operation.
  18. >
  19. >If you are using MS-DOS, ask in comp.os.msdos.programmer, but first have a l
  20. >by anonymous ftp at rtfm.mit.edu for that group's FAQ, which probably covers
  21. >this topic.  (Although I don't know _why_ you would want to do this - the la
  22. >thing I want _any_ program to do is to reboot the machine...)
  23. >
  24. >
  25. >Peter Bennett VE7CEI                | Vessels shall be deemed to be in sight
  26. >Internet: bennett@triumf.ca         | of one another only when one can be
  27. >Packet: ve7cei@ve7kit.#vanc.bc.ca   | observed visually from the other
  28. >TRIUMF, Vancouver, B.C., Canada     |                          ColRegs 3(k)
  29. >GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
  30. >
  31.  
  32. Far-out do i have to help everyone in this confrence????
  33. :-((   here is some source to get ya go-in from Aust!
  34.  
  35.  
  36. #define COLD           0               /* for cold boot */
  37. /* #define WARM           0x1234          /* for warm boot */
  38.  
  39. #define BOOT_SEG        0xffffL
  40. #define BOOT_OFF        0x0000L
  41. #define BOOT_ADR        ((BOOT_SEG << 16) | BOOT_OFF)
  42.  
  43. #define DOS_SEG         0x0040L
  44. #define RESET_FLAG      0x0072L
  45. #define RESET_ADR       ((DOS_SEG << 16) | RESET_FLAG)
  46.  
  47. main()
  48. {
  49.  void ((far *fp)()) = (void (far *)()) BOOT_ADR;
  50.  
  51.  *(int far *)RESET_ADR = COLD;
  52.  (*fp)();
  53.  return 0;
  54. }
  55.  
  56. /* -Chris */
  57. oh and good luck with rebooting ya computer...
  58.